<template>
  <a-space direction="vertical" style="width: 100%">
    <a-card title="费用类型查询">
      <a-form layout="inline">
        <a-form-item label="类型名称">
          <a-input v-model:value="queryParams.name" />
        </a-form-item>
        <a-form-item label="状态">
          <a-select v-model:value="queryParams.enabled" placeholder="选择状态">
            <a-select-option value="true">启用</a-select-option>
            <a-select-option value="false">停用</a-select-option>
          </a-select>
        </a-form-item>

        <a-form-item>
          <a-button type="primary" html-type="submit" @click="query">查询</a-button>
        </a-form-item>
        <a-form-item>
          <a-button @click="reset">重置</a-button>
        </a-form-item>
      </a-form>
    </a-card>
    <!--      <a-divider style="border-color: #7cb305" dashed />-->
    <a-card title="查询结果">
      <a-table
        :columns="columns"
        :data-source="resultDataSet"
        rowKey="uid"
        :pagination="paginationConfig"
      >
        <template #enabled="{ record }">
          <span v-if="record.enabled">启用</span>
          <span v-else>停用</span>
        </template>
        <template #action="{ record }">
          <a-button v-if="record.enabled" danger>停用</a-button>
          <a-button v-else type="primary">启用</a-button>
        </template>
      </a-table>
    </a-card>
  </a-space>
</template>

<script lang="ts" setup>
import { useExpenseTypeListFunctions } from '@/views/finance/expense-type/list/expenseTypeListFunctions'
const { paginationConfig, queryParams, columns, reset, query, resultDataSet } =
  useExpenseTypeListFunctions()
</script>
